<template>
    <div>
        <XDRadio v-model="radio" :list="list"></XDRadio>
        <div v-if="radio==true" class="registerCheck1"><p>检查部位</p><XDInput v-model="input2"></XDInput></div>
        <div v-if="radio==true" class="registerCheck2"><p>组织单位或人员</p><XDInput v-model="input3"></XDInput></div>
        <div v-if="radio==true" class="registerCheck1"><p>检查时间</p><XDInput v-model="input5"></XDInput></div>
        <el-dialog
                width="50%"
                title=""
                :visible.sync="innerVisible"
                append-to-body>
            <XDTable :config="config" @handleCurrentChange="handleCurrentChange"></XDTable>
        </el-dialog>
<p></p>
    </div>
</template>
<style lang="scss">
    .registerCheck1 {
        display: flex;
        padding-top: 10px;
        padding-bottom: 10px;
        p {
            margin-left: -70px; padding-right: 10px
        }
    }
    .registerCheck2 {
        display: flex;
        padding-top: 10px;
        padding-bottom: 10px;
        p {
            margin-left: -110px; padding-right: 10px
        }
    }
</style>
<script>
    import {typeJson} from "@/components/EleTableComp/config";
    export default {
        data() {
            return {
                input1: '',
                input2: '',
                input3: '',
                input4: '',
                input5: '',
                selected: 1,
                radio: 2,
                list: typeJson.bool,
                innerVisible: false,
                show: [
                    {
                        label: "",
                        prop: "",
                        value: ""
                    },
                    {
                        label: "",
                        prop: "",
                        value: ""
                    }
                ],
                config: {
                    header: {
                        addButton: false,
                        addButtonSlot: '',
                        search: [
                            {
                                type: 'dropDown',
                                list: typeJson.riskRule,
                                prop: 'discoverWay',
                                value: this.selected,
                                mineId: true,
                                label: '隐患发现方式'
                            },
                        ]
                    },
                    footer: {
                        pagination: true
                    },
                    table: [
                        {
                            label: '序号',
                            type: 'index'
                        },
                        {
                            label: '检查部位',
                            prop: 'examPlace',
                            value: '',
                        },
                        {
                            label: '组织单位或人员',
                            prop: 'checkMan',
                            value: '',
                        },
                        {
                            label: '检查时间',
                            prop: 'checkDate',
                            value: '',
                        },
                    ],
                    select: {
                        url: '/dailyExam/getListByDiscoverWay',
                        method: 'POST',
                        mineId: false,
                        companyId: false,
                        currentPage: 1,
                        pageSize: 10
                    },
                }
            }
        },
        components: {
        },
        methods: {
            // 完成点击
            handleCurrentChange(val, send) {
                this.input2 = val.examPlace
                this.input3 = val.checkMan
                this.input5 = val.checkDate
                let obj = {
                    discoverWay: this.selected,
                    examId: val.id
                }
                this.$store.state.slotData = obj
                this.innerVisible = false
            },
            // 获取参数
            getQueryVariable(variable) {
                let href = window.location.href
                let query = href.substring(href.indexOf('?')+1);
                let vars = query.split("&");
                for (var i = 0; i < vars.length; i++) {
                    let pair = vars[i].split("=");
                    if (pair[0] == variable) {
                        return pair[1];
                    }
                }
                return (false);
            },
        },
        watch: {
            "radio": function () {
                if(this.radio == true) {
                    this.innerVisible = true
                }
            }
        }
    }
</script>